﻿using System.Data;

/// <summary>
///     FillBaseEntity 的摘要说明
///     nodyang
/// </summary>
public class FillBaseEntity
{
    public static DataTable FillNumberIDbyDatable(DataTable templist)
    {
        if (templist.Columns.Contains("NumberID") == false)
        {
            templist.Columns.Add("NumberID", typeof (string));
        }
        var id = templist.Rows.Count;

        foreach (DataRow item in templist.Rows)
        {
            item["NumberID"] = id--;
        }

        return templist;
    }

    public static DataTable TurnOver(DataTable dt, string contr)
    {
        var table = dt.Copy();
        table.Rows.Clear();
        for (var i = dt.Rows.Count - 1; i >= 0; i--)
        {
            table.ImportRow(dt.Rows[i]);
        }


        return table;
    }
}